home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML Instance.sea / XML Instance / Required / plugins / HTMLWindow.jar / horst / NBSPView.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-03-18  |  1.6 KB  |  41 lines

  1. package horst;
  2.  
  3. import java.awt.Rectangle;
  4.  
  5. public class NBSPView extends View {
  6.    public NBSPView(View parent, Element e, HTMLPane container) {
  7.       super(parent, e, container);
  8.    }
  9.  
  10.    protected int getMinimumSpan(int axis) {
  11.       return this.getPreferredSpan(axis);
  12.    }
  13.  
  14.    protected int getPreferredSpan(int axis) {
  15.       return axis == 1 ? super.m_prefWidth : super.m_prefHeight;
  16.    }
  17.  
  18.    protected void init() {
  19.       super.m_prefWidth = ((View)this).getFontMetrics().stringWidth(" ");
  20.       super.m_prefHeight = ((View)this).getFontMetrics().getAscent();
  21.       super.m_minWidth = super.m_prefWidth;
  22.       super.m_minHeight = super.m_prefHeight;
  23.    }
  24.  
  25.    protected void invalidate() {
  26.       for(View parent = super.m_parent; parent != null; parent = parent.m_parent) {
  27.          parent.invalidate();
  28.       }
  29.  
  30.    }
  31.  
  32.    boolean isNoBreakSpace() {
  33.       return true;
  34.    }
  35.  
  36.    protected Rectangle layout(int x, int y, int width, LayoutInfo info) {
  37.       super.m_bounds.setBounds(x, y, this.getPreferredSpan(1), this.getPreferredSpan(0));
  38.       return super.m_bounds;
  39.    }
  40. }
  41.